const express = require("express");
const expressWs = require("express-ws");

const app = express();
expressWs(app);
app.use(require("cors")()); // 跨域
app.use(express.json({ limit: '10mb' })); // 识别json数据
app.use(express.urlencoded({ extended: false }));//表单支持


require("./plugins/db")(app);
const studentAPI = require("./api/student");
const teacherAPI = require("./api/teacher");
const adminAPI = require("./api/admin");
const commentAPI = require("./api/comment");
app.use('/student', studentAPI);
app.use('/teacher', teacherAPI);
app.use('/admin', adminAPI);
app.use('/comment', commentAPI);

app.listen(8000, () => {
  console.log("服务开启成功");
});
